package com.whu.waterworks.dao;
// default package

import java.util.List;

import com.whu.waterworks.model.Commontype;
import com.whu.waterworks.model.CommontypeId;

/**
 * Interface for TCommontypeDAO.
 * 
 * @author MyEclipse Persistence Tools
 */

public interface CommontypeDAO {
	/**
	 * Perform an initial save of a previously unsaved TCommontype entity. All
	 * subsequent persist actions of this entity should use the #update()
	 * method. This operation must be performed within the a database
	 * transaction context for the entity's data to be permanently saved to the
	 * persistence store, i.e., database. This method uses the
	 * {@link javax.persistence.EntityManager#persist(Object)
	 * EntityManager#persist} operation.
	 * 
	 * <pre>
	 * EntityManagerHelper.beginTransaction();
	 * ITCommontypeDAO.save(entity);
	 * EntityManagerHelper.commit();
	 * </pre>
	 * 
	 * @param entity
	 *            TCommontype entity to persist
	 * @throws RuntimeException
	 *             when the operation fails
	 */
	public void save(Commontype entity);

	/**
	 * Delete a persistent TCommontype entity. This operation must be performed
	 * within the a database transaction context for the entity's data to be
	 * permanently deleted from the persistence store, i.e., database. This
	 * method uses the {@link javax.persistence.EntityManager#remove(Object)
	 * EntityManager#delete} operation.
	 * 
	 * <pre>
	 * EntityManagerHelper.beginTransaction();
	 * ITCommontypeDAO.delete(entity);
	 * EntityManagerHelper.commit();
	 * entity = null;
	 * </pre>
	 * 
	 * @param entity
	 *            TCommontype entity to delete
	 * @throws RuntimeException
	 *             when the operation fails
	 */
	public void delete(Commontype entity);

	/**
	 * Persist a previously saved TCommontype entity and return it or a copy of
	 * it to the sender. A copy of the TCommontype entity parameter is returned
	 * when the JPA persistence mechanism has not previously been tracking the
	 * updated entity. This operation must be performed within the a database
	 * transaction context for the entity's data to be permanently saved to the
	 * persistence store, i.e., database. This method uses the
	 * {@link javax.persistence.EntityManager#merge(Object) EntityManager#merge}
	 * operation.
	 * 
	 * <pre>
	 * EntityManagerHelper.beginTransaction();
	 * entity = ITCommontypeDAO.update(entity);
	 * EntityManagerHelper.commit();
	 * </pre>
	 * 
	 * @param entity
	 *            TCommontype entity to update
	 * @return TCommontype the persisted TCommontype entity instance, may not be
	 *         the same
	 * @throws RuntimeException
	 *             if the operation fails
	 */
	public Commontype update(Commontype entity);


	public Commontype findById(CommontypeId id);

	/**
	 * Find all TCommontype entities with a specific property value.
	 * 
	 * @param propertyName
	 *            the name of the TCommontype property to query
	 * @param value
	 *            the property value to match
	 * @return List<TCommontype> found by query
	 */
	public List<Commontype> findByProperty(String propertyName, Object value);

	public List<Commontype> findByType(Object type);

	public List<Commontype> findByUppervalue(Object uppervalue);

	public List<Commontype> findByLowervalue(Object lowervalue);

	public List<Commontype> findByRange(Object range);

	/**
	 * Find all TCommontype entities.
	 * 
	 * @return List<TCommontype> all TCommontype entities
	 */
	public List<Commontype> findAll();
}